<template>
  <div id="root">
    <template v-if="app.hasToken">
      <!-- 左侧菜单区 -->
      <the-menu class="main-menu-box" />
      <!-- 右侧视图 -->
      <div class="main-container-content">
        <!-- 上部导航区 -->
        <the-nav />
        <!-- 子应用渲染区 -->
        <div class="main-container-view">
          <el-scrollbar class="wl-scroll">
            <!-- qiankun2.0  container 模式-->
            <div id="subapp-viewport" class="app-view-box"></div>
          </el-scrollbar>
        </div>
      </div>
    </template>
    <div v-else id="subapp-viewport" class="app-view-box"></div>
  </div>
  <router-view/>
</template>

<script type="module">
  import {ref,reactive,onMounted,computed,unref} from 'vue';
  import {useStore} from 'vuex';
  import { Options, Vue ,setup} from 'vue-class-component';



  function useApp(props,ctx) {
    const store = useStore();
    const hasToken = unref(computed(()=>{return !!store.getters.token}));

    console.log(hasToken)
    return {
      hasToken
    }
  }


  export default class App extends Vue {
    app = setup((props,ctx)=> useApp())
  }
</script>

<style lang="scss">
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}

#nav {
  padding: 30px;

  a {
    font-weight: bold;
    color: #2c3e50;

    &.router-link-exact-active {
      color: #42b983;
    }
  }
}
</style>
